package online.flowerinsnow.minecraft.bukkit.floweress.listener

import online.flowerinsnow.minecraft.bukkit.floweress.FlowerEss
import online.flowerinsnow.minecraft.bukkit.floweress.core.FlowerEssCore
import org.bukkit.event.EventHandler
import org.bukkit.event.Listener
import org.bukkit.event.player.PlayerJoinEvent
import org.bukkit.event.player.PlayerQuitEvent

class JoinLeftListener : Listener {
    @EventHandler
    fun onJoin(e : PlayerJoinEvent) {
        FlowerEssCore.visibleManager.getInvisiblePlayers().forEach {
            e.player.hidePlayer(FlowerEss.instance, it)
        }
    }

    @EventHandler
    fun onLeft(e : PlayerQuitEvent) {
        FlowerEssCore.visibleManager.showPlayer(e.player)
    }
}